﻿@model KL.Store.Web.Models.LoginModel
@using KL.Store.Core
@{
    ViewBag.Title = "Giriş";
    ViewBag.ShowFooterGraphs = "false";
    Layout = "~/Views/Shared/" + Parameters.Layout + ".cshtml";
    var pageClass = "col-xs-12 col-sm-12 col-md-12 col-lg-12 first last";
    var columnCssClass = "hidden-xs hidden-sm col-md-3 col-lg-2 first";
    var contentCssClass = "col-xs-12 col-sm-12 col-md-9 col-lg-10 first last right";
    var showColumn = true;
    var fbInfoClass = "bg-info bs-bg";
}
@if (Parameters.Theme == "DK")
{
    columnCssClass = "hidden-xs hidden-sm col-md-4 col-lg-3 first";
    contentCssClass = "col-xs-12 col-sm-12 col-md-8 col-lg-9 first last right";
    showColumn = true;
}
else if (Parameters.Theme == "EO")
{
    columnCssClass = "hidden-xs hidden-sm col-md-4 col-lg-3 first";
    contentCssClass = "col-xs-12 col-sm-12 col-md-8 col-lg-9 first last right";
    showColumn = true;
}
else if (Parameters.Theme == "WU")
{
    columnCssClass = "hidden-xs hidden-sm col-md-4 col-lg-3";
    contentCssClass = "col-xs-12 col-sm-12 col-md-8 col-lg-9 right";
    showColumn = true;
    fbInfoClass = "bg-success bs-bg";
}
else if (Parameters.Theme == "HA")
{
    columnCssClass = "hidden-xs hidden-sm col-md-4 col-lg-3 first";
    contentCssClass = "col-xs-12 col-sm-12 col-md-12 col-lg-12 first last right";
    showColumn = false;
}

<div class="@pageClass">
    <div class="breadcrumb col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="bcBorder"></div>
        <div class="bcLinks">
            <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
                <a href="/" itemprop="url">
                    <span itemprop="title">Anasayfa</span>
                </a>›
            </div>
            <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
                <a href="/Account/Index" itemprop="url">
                    <span itemprop="title">Hesabım</span>
                </a>›
            </div>
            <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
                <a href="/Account/Login" itemprop="url">
                    <span itemprop="title">Giriş Yap</span>
                </a>
            </div>
        </div>
        <div class="bcBorder"></div>
    </div>
    <div class="clearfix"></div>
</div>
@if (showColumn)
{
    <div class="@columnCssClass">
        @*@if (Parameters.ShowCategoryOnAccountPages)
        {
            Html.RenderAction("Categories", "Partials");
        }*@
        @{Html.RenderAction("Account", "Partials");}
        @{Html.RenderAction("Information", "Partials");}
    </div>
}
else
{
    ViewBag.hasSub = "true";
}
<div class="@contentCssClass">
    <div class="content">
        @if (Parameters.Theme == "HA")
        {
            <div class="loginpartials">
                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-4 account-block first" id="loginform">
                    @{Html.RenderAction("LoginPartial", "Account");}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-4 account-block" id="registerform">
                    @{Html.RenderAction("RegisterPartial", "Account");}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-4 account-block last" id="facebooklogin">
                    @{Html.RenderAction("FacebookLoginPartial", "Account");}
                </div>
                <div class="clearfix"></div>
                <script>
                    $(document).ready(function ()
                    {
                        if ($(document).width() > 999)
                        {
                            setAccHeights();
                        }
                    });
                    function setAccHeights()
                    {
                        var enYuksekLoginParcasi = 0;
                        $(".loginpartials .account-block").each(function ()
                        {
                            $(this).css("height", "auto");
                            if ($(this).height() > enYuksekLoginParcasi)
                            {
                                enYuksekLoginParcasi = $(this).height();
                            }
                        });
                        $(".loginpartials .account-block").height(enYuksekLoginParcasi);
                    }
                    $(".loginforminner").bind("DOMSubtreeModified", function ()
                    {
                        if ($(document).width() > 999)
                        {
                            setAccHeights();
                        }
                    });
                </script>
            </div>
        }
        else
        {
            <h1>Hesabım</h1>
            <div class="hidden-xs hidden-sm col-md-6 col-lg-6 account-block first">
                <div class="account-block-outer loginformouter">
                    <div class="account-block-inner loginforminner">
                        <h2>Yeni Üyelik Oluştur</h2>
                        @if (!string.IsNullOrEmpty(Parameters.FaceBookAppId))
                        {
                            <p>
                                Dilerseniz vakit kaybetmeyin
                                <img src="/Images/@Parameters.Theme/fb-ile-baglan.png" />
                                ile bağlanın.
                            </p>
                        }
                        <p>
                            Üye olarak hızlı ve güvenli alışverişe başlayabilirsiniz. Siparişlerinizin güncel durumlarını takip edebilir ve daha önce yapmış olduğunuz siparişlerinizi görüntüleyebilirsiniz.
                        </p>
                        <a href="@(Parameters.WebSiteSecureUrl)/Account/Register" class="btn btn-custom1">Üye Ol</a>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 account-block last">
                <div class="account-block-outer loginformouter">
                    <div class="account-block-inner loginforminner">
                        <h2>Giriş Yap</h2>
                        @if (!string.IsNullOrEmpty(Parameters.FaceBookAppId))
                        {
                            <div class="@(fbInfoClass)" style="margin-bottom: 15px; padding: 8px !important;">
                                <p style="font-size: 12.56px;">
                                    <span class="glyphicon glyphicon-info-sign"></span>&nbsp;Hızlı giriş yapmak için yukarıdaki
                                <img src="/Images/@Parameters.Theme/fb-ile-baglan.png" />
                                    butonunu kullanabilirsiniz.
                                    <span class="hidden-md hidden-lg"><br />Hesabınız yoksa, kaydolmak için <a href="@(Parameters.WebSiteSecureUrl)/Account/Register">tıklayın</a>.</span>
                                </p>
                            </div>
                        }
                        @using (Html.BeginForm(null, null, new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { name = "login", id = "login", @class = "form-horizontal" }))
                        {
                            if (!ViewData.ModelState.IsValid)
                            {
                            <div class="bg-danger">
                                @Html.ValidationSummary(true, "Giriş işlemi başarısız oldu. Lütfen bilgileri kontrol ediniz.")
                            </div>
                            }
                            <div class="form-group">
                                <label for="UserName" class="col-sm-4 control-label">E-Posta Adresi:</label>
                                <div class="col-sm-8">
                                    @Html.TextBoxFor(m => m.UserName, new { @type = "email", @class = "form-control", @placeHolder = "E-Posta Adresinizi Giriniz" })
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="Password" class="col-sm-4 control-label">Parolanız:</label>
                                <div class="col-sm-8">
                                    @Html.PasswordFor(m => m.Password, new { @class = "form-control", @placeHolder = "Parolanızı Giriniz" })
                                </div>
                            </div>
                            <div class="col-sm-4"></div>
                            <div class="col-sm-8 last" style="padding-left: 10px;">
                                <a onclick="$('#login').submit();" class="btn btn-custom1"><span>Giriş</span></a>

                                <a href="/Account/RemindPassword" class="right">Şifremi Unuttum</a>
                            </div>
                            <div class="clearfix"></div>
                        }
                    </div>
                </div>
            </div>
            <script type="text/javascript">
                $('#login input').keydown(function (e)
                {
                    if (e.keyCode == 13)
                    {
                        $('#login').submit();
                    }
                });
                $(document).ready(function ()
                {
                    if ($(window).width() < 980)
                    {
                        $(".account-block.first").parent().attr("class", $(".account-block.first").parent().attr("class") + " last");
                        $(".account-block.last").parent().attr("class", $(".account-block.last").parent().attr("class") + " first");
                    }
                });
            </script>
        }
    </div>
</div>
@if (Parameters.WebSiteTrackingCode != "")
{ 
    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', '@Parameters.WebSiteTrackingCode']);
        _gaq.push(['_setDomainName', '@Parameters.WebSiteTrackingDomainName']);
        _gaq.push(['_setAllowLinker', true]);
        _gaq.push(['_trackPageview']);

        (function ()
        {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
    </script>
}